#!/usr/bin/ruby
# Moths - an environment for mathy calculations
# Copyright (C) 2006 Mike Sutjipto
# Licensed under the GPL

# A simple interpreter

require 'moths.rb'

inter = Moths::Interpreter.new
while true
  print '> '
  line = gets

  if line.chomp == 'quit' then
    break
  end

  begin
    puts '=: ' + inter.eval_string(line)
  rescue Moths::MothsError => e
    puts '! ' + e
  end
end
